package com.cskaoyan.controller;

import com.cskaoyan.bean.MarketAdmin;
import com.cskaoyan.bean.common.BaseRespVo;
import com.cskaoyan.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author stone
 * @date 2022/09/06 11:41
 */
@RestController
@RequestMapping("admin/admin")
public class AdminAdminController {

    @Autowired
    AdminService adminService;

    @RequestMapping("query/{id}")
    public BaseRespVo query(@PathVariable("id") Integer id) {
        MarketAdmin marketAdmin = adminService.queryById(id);
        return BaseRespVo.ok(marketAdmin);
    }

    @RequestMapping("update")
    public BaseRespVo update(@RequestBody MarketAdmin admin) {
        adminService.modify(admin);
        return BaseRespVo.ok(null);
    }

    // where username = ? and password like ? and avatar in (?,?,?)
    /*@RequestMapping("list")
    public BaseRespVo list(String username,String password,String[] avatars,Integer page,Integer limit) {
        List<MarketAdmin> list = adminService.query(username,password,avatars,page,limit);
        return BaseRespVo.ok(list);
    }*/


}
